<template>
	<view class="">
		<u-navbar :customBack="back" :title="title" titleColor="#fff" backIconColor="#fff" :background="{background: 'var(--mainColor)'}"></u-navbar>
		<view class="u-p-y-40 u-p-x-50">
			<view class="flex flex-column align-center justify-center" v-if="type == 'add'">
				<image src="../static/mine/entry-suc.png" style="width: 106rpx;" mode="widthFix"></image>
				<text class="u-p-y-40 font-weight-bold">您入驻申请已经提交成功</text>
				<view class="flex flex-column">
					<text class="text-greey u-font-24">1.我们将在3个工作日内（不包括国家法定节假日）完成审核并 通过短信或邮件方式通知您</text>
				</view>
				<view class="flex justify-evenly u-m-y-40" style="width: 100%;">
					<dy-button width="250rpx" size="default" color="#FE572A" backgroundColor="#fff" borderColor="#FE572A" @click="showBackApply = true">撤销申请</dy-button>
					<dy-button width="250rpx" size="default" @click="toMine">个人中心</dy-button>
				</view>
			</view>
			<view class="flex flex-column align-center justify-center" v-else-if ="status == 0">
				<image src="../static/mine/entry-ing.png" style="width: 106rpx;" mode="widthFix"></image>
				<text class="u-p-y-40">正在审核中，请耐心等候～</text>
				<view class="flex flex-column" style="width: 100%;">
					<text class="text-greey">1.管理员已经在加急速度审核您的资料信息，请内心等候～</text>
					<text class="u-p-y-40 text-greey">2.如有疑问请联系网站客服</text>
				</view>
				<view class="flex justify-evenly u-m-y-40" style="width: 100%;">
					<dy-button width="250rpx" size="default" color="#FE572A" backgroundColor="#fff" borderColor="#FE572A" @click="showBackApply = true">撤销申请</dy-button>
				</view>
			</view>
			<view class="flex flex-column align-center justify-center" v-else-if="status == 1">
				<image src="../static/mine/entry-suc.png" style="width: 106rpx;" mode="widthFix"></image>
				<text class="u-p-y-40">恭喜您，已成功入驻！</text>
				<view class="flex flex-column" style="width: 100%;">
					<text class="text-greey">1.现在您可以登录商家后台管理系统，进入卖家中心，管理您的店铺啦，赶紧去吧～</text>
					<text class="u-p-y-40 text-greey">2.如有疑问请联系网站客服</text>
				</view>
				<view class="bg-light u-p-20 rounded-10" style="width: 100%;">
					<view class="flex align-center justify-between u-m-b-20">
						<text class="font-20">管理后台地址</text>
						<view class="flex align-center">
							<text class="font-20 text-greey flex" style="word-break: break-word; max-width: 350rpx;">{{info.login_url}}</text>
							<text class="main-text-color u-m-l-20" @click="$copy(info.login_url)">复制</text>
						</view>
					</view>
					<view class="flex align-center justify-between u-m-b-20">
						<text>后台账户名</text>
						<view class="flex align-center">
							<text>{{info.account}}</text>
							<text class="main-text-color u-m-l-20" @click="$copy(info.account)">复制</text>
						</view>
					</view>
					<view class="flex align-center justify-between">
						<text>后台密码</text>
						<view class="flex align-center">
							<text>admin123</text>
							<text class="main-text-color u-m-l-20" @click="$copy('admin123')">复制</text>
						</view>
					</view>
				</view>
			</view>
			<view class="flex flex-column align-center justify-center" v-else-if="status == 2">
				<image src="../static/mine/entry-faile.png" style="width: 106rpx;" mode="widthFix"></image>
				<text class="u-p-y-40">很遗憾，您没通过审核！原因是：{{refusetext}}</text>
				<view class="flex flex-column" style="width: 100%;">
					<text class="text-greey">1.现在您重新填写信息，再一次进行资格认证</text>
					<text class="u-p-y-40 text-greey">2.如有疑问请联系网站客服</text>
				</view>
				<view class="flex justify-evenly u-m-y-40" style="width: 100%;">
					<dy-button width="250rpx" size="default" color="#FE572A" backgroundColor="#fff" borderColor="#FE572A" @click="repert">重新申请</dy-button>
					<dy-button width="250rpx" size="default" @click="toMine">个人中心</dy-button>
				</view>
			</view>
			
		</view>
		<u-modal v-model="showBackApply" content="确定撤销全部申请？" :show-cancel-button="true" @confirm="backApply"></u-modal>
	</view>
</template>

<script>
	import { MineCenterApi } from '@/api/serves.js'
	export default {
		data() {
			return {
				showBackApply:false,
				title: '',
				type: '',
				status: '0',
				refusetext: "",
				info: '',
				way:'',
			};
		},
		onShow() {
			uni.removeStorageSync('applyForm_1')
			uni.removeStorageSync('applyForm_2')
			uni.removeStorageSync('applyForm_3')
		},
		onLoad(options) {
			console.log(options);
			this.type = options.type
			if(this.type == 'detail') {
				this.title = '申请结果'
				this._applyIndex()
			}
		},
		methods: {
			_applyIndex() {
				MineCenterApi.applyIndex().then(res => {
				  console.log('入驻配置信息', res);
				  console.log(res);
					if(res.code == 1){
						if(res.data.log){
							this.log = res.data.log
							this.status = res.data.log.status
							this.refusetext = res.data.log.reason
							this.info = res.data
							this.way = res.data.log.business_no ? true : false
						}
					}
				})
			},
			back() {
				if(this.type == 'detail') {
					uni.navigateBack()
				}
				if(this.type == 'add') {
					uni.navigateBack({
						delta:4
					})
				}
			},
			repert() {
				if(this.way){
					uni.redirectTo({
						url: '/pages/mine/mineEnterPages/mineEnterApply/apply'
					})
				}else{
					uni.redirectTo({
						url: '/pages/mine/mineEnterPages/mineEnterApplyXW/apply'
					})
				}
				
			},
			backApply() {
				MineCenterApi.applyRecall().then(res => {
					if(res.code == 1){
						this.$u.toast(res.msg, 2000)
						this.toMine()
					}else{
						this.$u.toast(res.msg, 2000)
					}
				})
			},
			toMine() {
				uni.switchTab({
					url: '/pages/tabbar/mine/mine'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
page {
	background-color: #fff;
}
</style>
